package com.example.sunmiv1.entity;

import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class GoodsStoreRetreatInfo implements Serializable {
    /**
     * status : 1
     * msg : 查詢成功
     * data : [{"id":"84","merchant_id":"1","store_id":"1","purchase_order_id":"48","warehouse_id":"7","supplier_id":"1216","goods_id":"2268","sku_id":"0","goods_name":"測試調撥","sku_name":"","sku_id_list":"","goods_class_id":"323","goods_number":"52602","sku_goods_number":"","goods_code":"","sku_code":"","company":"","attribute_state":"1","pricing_method":"1","purchase_price":"1.00","sku_num":"1.000","purchase_num":100,"surplus_num":81,"warehousing_num":"0.000","retreat_num":19,"subtotal":"100.00","remarks":"","order_number":"SC201910150048","add_time":"1571133641"},{"id":"83","merchant_id":"1","store_id":"1","purchase_order_id":"48","warehouse_id":"7","supplier_id":"1216","goods_id":"2267","sku_id":"0","goods_name":"測試調撥2","sku_name":"","sku_id_list":"","goods_class_id":"514","goods_number":"88368","sku_goods_number":"","goods_code":"","sku_code":"","company":"","attribute_state":"1","pricing_method":"1","purchase_price":"4.00","sku_num":"1.000","purchase_num":100,"surplus_num":97,"warehousing_num":"0.000","retreat_num":3,"subtotal":"400.00","remarks":"","order_number":"SC201910150048","add_time":"1571133641"},{"id":"68","merchant_id":"1","store_id":"1","purchase_order_id":"39","warehouse_id":"7","supplier_id":"1216","goods_id":"2224","sku_id":"0","goods_name":"飛利浦顯示器","sku_name":"","sku_id_list":"","goods_class_id":"323","goods_number":"52666","sku_goods_number":"","goods_code":"1155025948","sku_code":"","company":"","attribute_state":"1","pricing_method":"1","purchase_price":"3.00","sku_num":"1.000","purchase_num":3,"surplus_num":1,"warehousing_num":"0.000","retreat_num":2,"subtotal":"9.00","remarks":"","order_number":"SC201909100039","add_time":"1568100487"}]
     */

    private int status;
    private String msg;
    private ArrayList<DataBean> data;

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public ArrayList<DataBean> getData() {
        return data;
    }

    public void setData(ArrayList<DataBean> data) {
        this.data = data;
    }

    public static class DataBean implements Serializable {
        /**
         * id : 84
         * merchant_id : 1
         * store_id : 1
         * purchase_order_id : 48
         * warehouse_id : 7
         * supplier_id : 1216
         * goods_id : 2268
         * sku_id : 0
         * goods_name : 測試調撥
         * sku_name :
         * sku_id_list :
         * goods_class_id : 323
         * goods_number : 52602
         * sku_goods_number :
         * goods_code :
         * sku_code :
         * company :
         * attribute_state : 1
         * pricing_method : 1
         * purchase_price : 1.00
         * sku_num : 1.000
         * purchase_num : 100
         * surplus_num : 81
         * warehousing_num : 0.000
         * retreat_num : 19
         * subtotal : 100.00
         * remarks :
         * order_number : SC201910150048
         * add_time : 1571133641
         */

        private String id;
        private String merchant_id;
        private String store_id;
        private String purchase_order_id;
        private String warehouse_id;
        private String supplier_id;
        private String goods_id;
        private String sku_id;
        private String goods_name;  //1
        private String sku_name;   //2
        private String sku_id_list;
        private String goods_class_id;
        private String goods_number; //  attribute_state==1  3
        private String sku_goods_number; // attribute_state==2  3
        private String goods_code;  //4
        private String sku_code;
        private String company;
        private String attribute_state;
        private String pricing_method;
        private Double purchase_price;//8
        private String sku_num;
        private Double purchase_num;   //5
        private Double surplus_num;   //7
        private String warehousing_num;
        private Double retreat_num;  //6
        private String subtotal;
        private String remarks;//備註
        private String order_number;//9
        private String add_time;

        private boolean checked;
        private Double retreat_price; // 退貨價
        private Double retreat_num_act; // 退貨數量

        private String serial_number_state;
        private List<SerialListBean> serial_list;

        public List<SerialListBean> getSerial_list() {
            if (serial_list == null) {
                return new ArrayList<>();
            }
            return serial_list;
        }

        public void setSerial_list(List<SerialListBean> serial_list) {
            this.serial_list = serial_list;
        }

        public String getSerial_number_state() {
            return serial_number_state == null ? "" : serial_number_state;
        }

        public void setSerial_number_state(String serial_number_state) {
            this.serial_number_state = serial_number_state;
        }

        public Double getRetreat_price() {
            return retreat_price;
        }

        public Double getRetreat_num_act() {
            if (retreat_num_act == null) {
                return 0.0;
            }
            return retreat_num_act;
//            return retreat_num_act==null?0.0:retreat_num_act;
        }


        public void setRetreat_price(Double retreat_price) {
            this.retreat_price = retreat_price;
        }

        public void setRetreat_num_act(Double retreat_num_act) {
            this.retreat_num_act = retreat_num_act;
        }

        public boolean isChecked() {
            return checked;
        }

        public void setChecked(boolean checked) {
            this.checked = checked;
        }


        private String build_date;
        private String quality_guarantee_period;

        public String getBuild_date() {
            if (build_date == null) {
                return "";
            }
            if (build_date.indexOf("-") != -1) {
                return build_date;
            } else {
                String a = build_date == null ? "" : build_date + "000";
                SimpleDateFormat time = new SimpleDateFormat("yyyy年MM月dd日");
                if (TextUtils.isEmpty(a) || TextUtils.isEmpty(build_date)) {
                    return "";
                } else {
                    return time.format(new Date(Long.parseLong(a)));
                }
            }
        }

        public void setBuild_date(String build_date) {
            this.build_date = build_date;
        }

        public String getQuality_guarantee_period() {
            String a = quality_guarantee_period == null ? "" : quality_guarantee_period;
            return a;
        }

        public void setQuality_guarantee_period(String quality_guarantee_period) {
            this.quality_guarantee_period = quality_guarantee_period;
        }

        public String getGoodsNumByAttr() {
            if (this.attribute_state.equals("2")) {
                return getSku_goods_number();
            } else {
                return getGoods_number();
            }
        }

        public String getGoodsCodeByAttr() {
            if (this.attribute_state.equals("2")) {
                return getSku_code();
            } else {
                return getGoods_code();
            }
        }


        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getMerchant_id() {
            return merchant_id;
        }

        public void setMerchant_id(String merchant_id) {
            this.merchant_id = merchant_id;
        }

        public String getStore_id() {
            return store_id;
        }

        public void setStore_id(String store_id) {
            this.store_id = store_id;
        }

        public String getPurchase_order_id() {
            return purchase_order_id;
        }

        public void setPurchase_order_id(String purchase_order_id) {
            this.purchase_order_id = purchase_order_id;
        }

        public String getWarehouse_id() {
            return warehouse_id;
        }

        public void setWarehouse_id(String warehouse_id) {
            this.warehouse_id = warehouse_id;
        }

        public String getSupplier_id() {
            return supplier_id;
        }

        public void setSupplier_id(String supplier_id) {
            this.supplier_id = supplier_id;
        }

        public String getGoods_id() {
            return goods_id;
        }

        public void setGoods_id(String goods_id) {
            this.goods_id = goods_id;
        }

        public String getSku_id() {
            return sku_id;
        }

        public void setSku_id(String sku_id) {
            this.sku_id = sku_id;
        }

        public String getGoods_name() {
            return goods_name;
        }

        public void setGoods_name(String goods_name) {
            this.goods_name = goods_name;
        }

        public String getSku_name() {
            return sku_name;
        }

        public void setSku_name(String sku_name) {
            this.sku_name = sku_name;
        }

        public String getSku_id_list() {
            return sku_id_list;
        }

        public void setSku_id_list(String sku_id_list) {
            this.sku_id_list = sku_id_list;
        }

        public String getGoods_class_id() {
            return goods_class_id;
        }

        public void setGoods_class_id(String goods_class_id) {
            this.goods_class_id = goods_class_id;
        }

        public String getGoods_number() {
            return goods_number;
        }

        public void setGoods_number(String goods_number) {
            this.goods_number = goods_number;
        }

        public String getSku_goods_number() {
            return sku_goods_number;
        }

        public void setSku_goods_number(String sku_goods_number) {
            this.sku_goods_number = sku_goods_number;
        }

        public String getGoods_code() {
            return goods_code;
        }

        public void setGoods_code(String goods_code) {
            this.goods_code = goods_code;
        }

        public String getSku_code() {
            return sku_code;
        }

        public void setSku_code(String sku_code) {
            this.sku_code = sku_code;
        }

        public String getCompany() {
            return company;
        }

        public void setCompany(String company) {
            this.company = company;
        }

        public String getAttribute_state() {
            return attribute_state;
        }

        public void setAttribute_state(String attribute_state) {
            this.attribute_state = attribute_state;
        }

        public String getPricing_method() {
            return pricing_method;
        }

        public void setPricing_method(String pricing_method) {
            this.pricing_method = pricing_method;
        }

        public Double getPurchase_price() {
            return purchase_price;
        }

        public void setPurchase_price(Double purchase_price) {
            this.purchase_price = purchase_price;
        }

        public String getSku_num() {
            return sku_num;
        }

        public void setSku_num(String sku_num) {
            this.sku_num = sku_num;
        }

        public Double getPurchase_num() {
            return purchase_num;
        }

        public void setPurchase_num(Double purchase_num) {
            this.purchase_num = purchase_num;
        }

        public Double getSurplus_num() {
            return surplus_num;
        }

        public void setSurplus_num(Double surplus_num) {
            this.surplus_num = surplus_num;
        }

        public String getWarehousing_num() {
            return warehousing_num;
        }

        public void setWarehousing_num(String warehousing_num) {
            this.warehousing_num = warehousing_num;
        }

        public Double getRetreat_num() {
            return retreat_num;
        }

        public void setRetreat_num(Double retreat_num) {
            this.retreat_num = retreat_num;
        }

        public String getSubtotal() {
            return subtotal;
        }

        public void setSubtotal(String subtotal) {
            this.subtotal = subtotal;
        }

        public String getRemarks() {
            return remarks;
        }

        public void setRemarks(String remarks) {
            this.remarks = remarks;
        }

        public String getOrder_number() {
            return order_number;
        }

        public void setOrder_number(String order_number) {
            this.order_number = order_number;
        }

        public String getAdd_time() {
            return add_time;
        }

        public void setAdd_time(String add_time) {
            this.add_time = add_time;
        }

        public static class SerialListBean implements Serializable{
            private String id;
            private String main_serial_number;
            private String auxiliary_serial_number_one;
            private String auxiliary_serial_number_two;

            public SerialListBean(String id,String main_serial_number, String auxiliary_serial_number_one, String auxiliary_serial_number_two) {
                this.id = id;
                this.main_serial_number = main_serial_number;
                this.auxiliary_serial_number_one = auxiliary_serial_number_one;
                this.auxiliary_serial_number_two = auxiliary_serial_number_two;
            }

            public String getMain_serial_number() {
                return main_serial_number == null ? "" : main_serial_number;
            }

            public void setMain_serial_number(String main_serial_number) {
                this.main_serial_number = main_serial_number;
            }

            public String getAuxiliary_serial_number_one() {
                return auxiliary_serial_number_one == null ? "" : auxiliary_serial_number_one;
            }

            public void setAuxiliary_serial_number_one(String auxiliary_serial_number_one) {
                this.auxiliary_serial_number_one = auxiliary_serial_number_one;
            }

            public String getAuxiliary_serial_number_two() {
                return auxiliary_serial_number_two == null ? "" : auxiliary_serial_number_two;
            }

            public void setAuxiliary_serial_number_two(String auxiliary_serial_number_two) {
                this.auxiliary_serial_number_two = auxiliary_serial_number_two;
            }
        }

        public DataBean(ScanGoodInfo.DataBean dataBean) {
            this.id = dataBean.getId();
            this.merchant_id = dataBean.getMerchant_id();
            this.store_id = dataBean.getStore_id();
            this.purchase_order_id = purchase_order_id;
            this.warehouse_id = dataBean.getWarehouse_id();
            this.supplier_id = dataBean.getGoods_id();
            this.goods_id = dataBean.getGoods_id();
            this.sku_id = dataBean.getSku_id();
            this.goods_name = dataBean.getGoods_name();
            this.sku_name = dataBean.getSku_name();
            this.sku_id_list = dataBean.getSku_id_list();
            this.goods_class_id = dataBean.getGoods_class_id();
            this.goods_number = dataBean.getGoods_number();
            this.sku_goods_number = dataBean.getSku_goods_number();
            this.goods_code = dataBean.getGoods_code();
            this.sku_code = dataBean.getSku_code();
            this.company = dataBean.getCompany();
            this.attribute_state = dataBean.getAttribute_state();
            this.pricing_method = dataBean.getPricing_method();
            this.purchase_price = Double.parseDouble(dataBean.getPurchase_price() + "");
            this.sku_num = dataBean.getSku_num();
            this.purchase_num = Double.parseDouble(dataBean.getPurchase_num() + "");
            this.surplus_num = dataBean.getSurplus_num();
            this.warehousing_num = dataBean.getWarehousing_num();
            this.retreat_num = dataBean.getRetreat_num();
            this.subtotal = dataBean.getSubtotal();
            this.remarks = dataBean.getRemarks();
            this.order_number = dataBean.getOrder_number();
            this.add_time = dataBean.getAdd_time();
            this.checked = checked;
            this.retreat_price = retreat_price;
            this.retreat_num_act = Double.parseDouble(dataBean.getRetreat_num_act() + "");
            this.build_date = dataBean.getBuild_date();
            this.quality_guarantee_period = dataBean.getQuality_guarantee_period();
        }
    }

}
